home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************
- * *
- * WinLIB PRO Revision II: Object manipulation module *
- * *
- * Copyright (c) 1994, Bitgate Software *
- * *
- ********************************************************************/
-
- #include <aes.h>
- #include <stdio.h>
-
- #include "winlib.h"
-
- #ifdef __TURBOC__
- #pragma warn -pia
- #endif
-
- #ifndef __OBJECTS__
- #define __OBJECTS__
- #endif
-
- /*
- * Change resource object state
- *
- * This function *should* be used to change and update objects in windows.
- * It is an interception of objc_change and changes objects in
- * the same fashion, but updates objects correctly in windows.
- *
- * This procedure has the same parameters as objc_change except
- * for that clipping coordinates are not required.
- */
- GLOBAL void Objc_Change(OBJECT *tree, int ob_cobject, int ob_crecvd, int ob_cnewstate, int ob_credraw)
- {
- objc_change(tree, ob_cobject, ob_crecvd, 0, 0, 0, 0, ob_cnewstate, 0);
- if (ob_credraw) {
- WINDOW *win = WindowChain;
-
- if (!(win->style & S_MULTICOPYABLE))
- win = (WINDOW *) WLocateWindow('TREE', tree);
-
- if (win->style & S_MULTICOPYABLE) {
- while (win->next) {
- if (win->tree == tree) {
- GRECT own, temp;
- int x, y;
-
- WMoveWindow(win, -1, -1, -1, -1);
- objc_offset(win->tree, ob_cobject, &x, &y);
-
- own.g_x = x;
- own.g_y = y;
- own.g_w = win->tree[ob_cobject].ob_width;
- own.g_h = win->tree[ob_cobject].ob_height;
-
- wind_update(BEG_UPDATE);
-
- WWindGet(win, WF_FIRSTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- while (temp.g_w && temp.g_h) {
- if (rc_intersect(&temp, &own)) {
- switch (win->tree[ob_cobject].ob_type & 0xff) {
- case G_BUTTON:
- case G_USERDEF:
- case G_BOXCHAR:
- case G_BOX:
- case G_STRING:
- case G_IMAGE:
- if (ob_cobject == 0)
- objc_draw(win->tree, 0, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
-
- default:
- if ((ob_cobject == 0) || ((win->tree[ob_cobject].ob_type & 0x0F) == G_IMAGE))
- objc_draw(win->tree, 0, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
- }
- }
-
- WWindGet(win, WF_NEXTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- }
-
- wind_update(END_UPDATE);
- }
- win = win->next;
- }
- } else {
- GRECT own, temp;
- int x, y;
-
- WMoveWindow(win, -1, -1, -1, -1);
- objc_offset(win->tree, ob_cobject, &x, &y);
-
- own.g_x = x;
- own.g_y = y;
- own.g_w = win->tree[ob_cobject].ob_width;
- own.g_h = win->tree[ob_cobject].ob_height;
-
- wind_update(BEG_UPDATE);
-
- WWindGet(win, WF_FIRSTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- while (temp.g_w && temp.g_h) {
- if (rc_intersect(&temp, &own)) {
- switch (win->tree[ob_cobject].ob_type & 0xff) {
- case G_BUTTON:
- case G_USERDEF:
- case G_BOXCHAR:
- case G_BOX:
- case G_STRING:
- case G_IMAGE:
- if (ob_cobject == 0)
- objc_draw(win->tree, 0, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
-
- default:
- if ((ob_cobject == 0) || ((win->tree[ob_cobject].ob_type & 0x0F) == G_IMAGE))
- objc_draw(win->tree, 0, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
- }
- }
-
- WWindGet(win, WF_NEXTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- }
-
- wind_update(END_UPDATE);
- }
- }
- }
-
- GLOBAL void WObjc_Change(OBJECT *tree, int ob_cobject, int ob_crecvd, int ob_cnewstate, int ob_credraw)
- {
- objc_change(tree, ob_cobject, ob_crecvd, 0, 0, 0, 0, ob_cnewstate, 0);
- if (ob_credraw) {
- GRECT own, temp;
- int x, y;
-
- objc_offset(tree, ob_cobject, &x, &y);
-
- own.g_x = x;
- own.g_y = y;
- own.g_w = tree[ob_cobject].ob_width;
- own.g_h = tree[ob_cobject].ob_height;
-
- wind_update(BEG_UPDATE);
-
- wind_get(0, WF_FIRSTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- while (temp.g_w && temp.g_h) {
- if (rc_intersect(&temp, &own)) {
- switch (tree[ob_cobject].ob_type & 0xff) {
- case G_BUTTON:
- case G_USERDEF:
- case G_BOXCHAR:
- case G_BOX:
- case G_STRING:
- case G_IMAGE:
- if (ob_cobject == 0)
- objc_draw(tree, 0, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
-
- default:
- if ((ob_cobject == 0) || ((tree[ob_cobject].ob_type & 0x0F) == G_IMAGE))
- objc_draw(tree, 0, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
- }
- }
-
- wind_get(0, WF_NEXTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- }
-
- wind_update(END_UPDATE);
- }
- }
-
- GLOBAL void WObjc_Draw(OBJECT *tree, int ob_cobject, int ob_cdepth, int clipx, int clipy, int clipw, int cliph)
- {
- WINDOW *win = WindowChain;
-
- if (!(win->style & S_MULTICOPYABLE))
- win = (WINDOW *) WLocateWindow('TREE', tree);
-
- if (win->style & S_MULTICOPYABLE) {
- while (win->next) {
- if (win->tree == tree) {
- GRECT own, temp;
- int x, y;
-
- WMoveWindow(win, -1, -1, -1, -1);
- objc_offset(win->tree, ob_cobject, &x, &y);
-
- own.g_x = x;
- own.g_y = y;
- own.g_w = win->tree[ob_cobject].ob_width;
- own.g_h = win->tree[ob_cobject].ob_height;
-
- wind_update(BEG_UPDATE);
-
- WWindGet(win, WF_FIRSTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- while (temp.g_w && temp.g_h) {
- if (rc_intersect(&temp, &own)) {
- switch (win->tree[ob_cobject].ob_type & 0xff) {
- case G_BUTTON:
- case G_USERDEF:
- case G_BOXCHAR:
- case G_BOX:
- case G_STRING:
- case G_IMAGE:
- if (ob_cobject == 0)
- objc_draw(win->tree, ob_cobject, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
-
- default:
- if ((ob_cobject == 0) || ((win->tree[ob_cobject].ob_type & 0x0F) == G_IMAGE))
- objc_draw(win->tree, ob_cobject, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
- }
- }
-
- WWindGet(win, WF_NEXTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- }
-
- wind_update(END_UPDATE);
- }
- win = win->next;
- }
- } else {
- GRECT own, temp;
- int x, y;
-
- WMoveWindow(win, -1, -1, -1, -1);
- objc_offset(win->tree, ob_cobject, &x, &y);
-
- own.g_x = x;
- own.g_y = y;
- own.g_w = win->tree[ob_cobject].ob_width;
- own.g_h = win->tree[ob_cobject].ob_height;
-
- wind_update(BEG_UPDATE);
-
- WWindGet(win, WF_FIRSTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- while (temp.g_w && temp.g_h) {
- if (rc_intersect(&temp, &own)) {
- switch (win->tree[ob_cobject].ob_type & 0xff) {
- case G_BUTTON:
- case G_USERDEF:
- case G_BOXCHAR:
- case G_BOX:
- case G_STRING:
- case G_IMAGE:
- if (ob_cobject == 0)
- objc_draw(win->tree, ob_cobject, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
-
- default:
- if ((ob_cobject == 0) || ((win->tree[ob_cobject].ob_type & 0x0F) == G_IMAGE))
- objc_draw(win->tree, ob_cobject, 99, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
- else
- objc_draw(win->tree, ob_cobject, 2, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
-
- break;
- }
- }
-
- WWindGet(win, WF_NEXTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
- }
-
- wind_update(END_UPDATE);
- }
- }
-